<template>
	<view class="bank">
		<view class="bank_info" v-if="info.bank_name">
			<p>{{$t('bank.account')}}（1）</p>
			<view class="info">
				<p>{{info.bank_name}}</p>
				<text>{{info.account_number}}</text>
			</view>
		</view>
		<view class="btn row flex-center" v-if="!info.bank_name" @click.stop="handleBank">
			<u-icon name="plus" color="#000000" size="18"></u-icon>
			<text>{{$t('edit.bank.account')}}</text>
		</view>
		<view class="btn row flex-center" v-if="info.bank_name" @click.stop="handleBank">
			<u-icon name="edit-pen" color="#000000" size="18"></u-icon>
			<text>{{$t('edit.bank.card')}}</text>
		</view>
	</view>
</template>

<script>
	import {
		getMyBank
	} from "@/lib/service"
	export default {
		data() {
			return {
				info: {
					bank_name: "",
					account_name: "",
					account_number: ""
				}
			}
		},
		onShow() {
			this.myInfo()

		},
		methods: {
			myInfo() {
				getMyBank().then(res => {
					console.log('data//////', res.data)
					this.info = res.data || {
						bank_name: "",
						account_name: "",
						account_number: ""
					};
				})
			},
			handleBank(){
				uni.navigateTo({
					url:"./bank"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bank {
		padding: 30rpx;

		.bank_info {
			padding: 28rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(47, 60, 111, 0.06);
			border-radius: 20rpx;

			p {
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				margin-bottom: 20rpx;
			}

			.info {
				padding: 20rpx;
				background: #E90C0C;
				border-radius: 20rpx;

				p {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					margin-bottom: 20rpx;
					color: #ffffff;
				}

				text {
					display: block;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					text-align: right;
					color: #FFFEFE;
					opacity: 0.5;
				}
			}
		}

		.btn {
			width: 682rpx;
			height: 110rpx;
			box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(47, 60, 111, 0.06);
			border-radius: 55rpx;
			border: 1px solid #999999;
			margin-top: 30rpx;

			text {
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				margin-left: 10rpx;
			}
		}
	}
</style>